<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no">
  <meta name="description" content="API docs for the addPlaceholder method from the ParagraphBuilder class, for the Dart programming language.">
  <title>addPlaceholder method - ParagraphBuilder class - dart:ui library - Dart API</title>
  <!-- required because all the links are pseudo-absolute -->
  <base href="../..">

  <link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500,400i,400,300|Source+Sans+Pro:400,300,700" rel="stylesheet">
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  <link rel="stylesheet" href="static-assets/github.css">
  <link rel="stylesheet" href="static-assets/styles.css">
  <link rel="icon" href="static-assets/favicon.png">
  
</head>

<body>

<div id="overlay-under-drawer"></div>

<header id="title">
  <button id="sidenav-left-toggle" type="button">&nbsp;</button>
  <ol class="breadcrumbs gt-separated dark hidden-xs">
    <li><a href="index.html">pin_code_fields</a></li>
    <li><a href="dart-ui/dart-ui-library.html">dart:ui</a></li>
    <li><a href="dart-ui/ParagraphBuilder-class.html">ParagraphBuilder</a></li>
    <li class="self-crumb">addPlaceholder method</li>
  </ol>
  <div class="self-name">addPlaceholder</div>
  <form class="search navbar-right" role="search">
    <input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
  </form>
</header>

<main>

  <div id="dartdoc-sidebar-left" class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
    <header id="header-search-sidebar" class="hidden-l">
      <form class="search-sidebar" role="search">
        <input type="text" id="search-sidebar" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
      </form>
    </header>
    
    <ol class="breadcrumbs gt-separated dark hidden-l" id="sidebar-nav">
      <li><a href="index.html">pin_code_fields</a></li>
      <li><a href="dart-ui/dart-ui-library.html">dart:ui</a></li>
      <li><a href="dart-ui/ParagraphBuilder-class.html">ParagraphBuilder</a></li>
      <li class="self-crumb">addPlaceholder method</li>
    </ol>
    
    <h5>ParagraphBuilder class</h5>
    <ol>
      <li class="section-title"><a href="dart-ui/ParagraphBuilder-class.html#constructors">Constructors</a></li>
      <li><a href="dart-ui/ParagraphBuilder/ParagraphBuilder.html">ParagraphBuilder</a></li>
    
      <li class="section-title">
        <a href="dart-ui/ParagraphBuilder-class.html#instance-properties">Properties</a>
      </li>
      <li><a href="dart-ui/ParagraphBuilder/placeholderCount.html">placeholderCount</a></li>
      <li><a href="dart-ui/ParagraphBuilder/placeholderScales.html">placeholderScales</a></li>
      <li class="inherited"><a href="dart-core/Object/hashCode.html">hashCode</a></li>
      <li class="inherited"><a href="dart-core/Object/runtimeType.html">runtimeType</a></li>
    
      <li class="section-title"><a href="dart-ui/ParagraphBuilder-class.html#instance-methods">Methods</a></li>
      <li><a href="dart-ui/ParagraphBuilder/addPlaceholder.html">addPlaceholder</a></li>
      <li><a href="dart-ui/ParagraphBuilder/addText.html">addText</a></li>
      <li><a href="dart-ui/ParagraphBuilder/build.html">build</a></li>
      <li><a href="dart-ui/ParagraphBuilder/pop.html">pop</a></li>
      <li><a href="dart-ui/ParagraphBuilder/pushStyle.html">pushStyle</a></li>
      <li class="inherited"><a href="dart-core/Object/noSuchMethod.html">noSuchMethod</a></li>
      <li class="inherited"><a href="dart-core/Object/toString.html">toString</a></li>
    
      <li class="section-title inherited"><a href="dart-ui/ParagraphBuilder-class.html#operators">Operators</a></li>
      <li class="inherited"><a href="dart-core/Object/operator_equals.html">operator ==</a></li>
    
    
    
    </ol>
  </div><!--/.sidebar-offcanvas-->

  <div id="dartdoc-main-content" class="col-xs-12 col-sm-9 col-md-8 main-content">
      <div><h1><span class="kind-method">addPlaceholder</span> method</h1></div>

    <section class="multi-line-signature">
      <span class="returntype">void</span>
            <span class="name ">addPlaceholder</span>
(<wbr><span class="parameter" id="addPlaceholder-param-width"><span class="type-annotation"><a href="dart-core/double-class.html">double</a></span> <span class="parameter-name">width</span>, </span> <span class="parameter" id="addPlaceholder-param-height"><span class="type-annotation"><a href="dart-core/double-class.html">double</a></span> <span class="parameter-name">height</span>, </span> <span class="parameter" id="addPlaceholder-param-alignment"><span class="type-annotation"><a href="dart-ui/PlaceholderAlignment-class.html">PlaceholderAlignment</a></span> <span class="parameter-name">alignment</span>, {</span> <span class="parameter" id="addPlaceholder-param-scale"><span class="type-annotation"><a href="dart-core/double-class.html">double</a></span> <span class="parameter-name">scale</span>: <span class="default-value">1.0</span>, </span> <span class="parameter" id="addPlaceholder-param-baselineOffset"><span class="type-annotation"><a href="dart-core/double-class.html">double</a></span> <span class="parameter-name">baselineOffset</span>, </span> <span class="parameter" id="addPlaceholder-param-baseline"><span class="type-annotation"><a href="dart-ui/TextBaseline-class.html">TextBaseline</a></span> <span class="parameter-name">baseline</span></span> })
      
    </section>
    <section class="desc markdown">
      <p>Adds an inline placeholder space to the paragraph.</p>
<p>The paragraph will contain a rectangular space with no text of the dimensions
specified.</p>
<p>The <code>width</code> and <code>height</code> parameters specify the size of the placeholder rectangle.</p>
<p>The <code>alignment</code> parameter specifies how the placeholder rectangle will be vertically
aligned with the surrounding text. When <a href="dart-ui/PlaceholderAlignment-class.html">PlaceholderAlignment.baseline</a>,
<a href="dart-ui/PlaceholderAlignment-class.html">PlaceholderAlignment.aboveBaseline</a>, and <a href="dart-ui/PlaceholderAlignment-class.html">PlaceholderAlignment.belowBaseline</a>
alignment modes are used, the baseline needs to be set with the <code>baseline</code>.
When using <a href="dart-ui/PlaceholderAlignment-class.html">PlaceholderAlignment.baseline</a>, <code>baselineOffset</code> indicates the distance
of the baseline down from the top of of the rectangle. The default <code>baselineOffset</code>
is the <code>height</code>.</p>
<p>Examples:</p><ul><li>For a 30x50 placeholder with the bottom edge aligned with the bottom of the text, use:
<code>addPlaceholder(30, 50, PlaceholderAlignment.bottom);</code></li><li>For a 30x50 placeholder that is vertically centered around the text, use:
<code>addPlaceholder(30, 50, PlaceholderAlignment.middle);</code>.</li><li>For a 30x50 placeholder that sits completely on top of the alphabetic baseline, use:
<code>addPlaceholder(30, 50, PlaceholderAlignment.aboveBaseline, baseline: TextBaseline.alphabetic)</code>.</li><li>For a 30x50 placeholder with 40 pixels above and 10 pixels below the alphabetic baseline, use:
<code>addPlaceholder(30, 50, PlaceholderAlignment.baseline, baseline: TextBaseline.alphabetic, baselineOffset: 40)</code>.</li></ul>
<p>Lines are permitted to break around each placeholder.</p>
<p>Decorations will be drawn based on the font defined in the most recently
pushed <a href="dart-ui/TextStyle-class.html">TextStyle</a>. The decorations are drawn as if unicode text were present
in the placeholder space, and will draw the same regardless of the height and
alignment of the placeholder. To hide or manually adjust decorations to fit,
a text style with the desired decoration behavior should be pushed before
adding a placeholder.</p>
<p>Any decorations drawn through a placeholder will exist on the same canvas/layer
as the text. This means any content drawn on top of the space reserved by
the placeholder will be drawn over the decoration, possibly obscuring the
decoration.</p>
<p>Placeholders are represented by a unicode 0xFFFC "object replacement character"
in the text buffer. For each placeholder, one object replacement character is
added on to the text buffer.</p>
<p>The <code>scale</code> parameter will scale the <code>width</code> and <code>height</code> by the specified amount,
and keep track of the scale. The scales of placeholders added can be accessed
through <a href="dart-ui/ParagraphBuilder/placeholderScales.html">placeholderScales</a>. This is primarily used for acessibility scaling.</p>
    </section>
    
    <section class="summary source-code" id="source">
      <h2><span>Implementation</span></h2>
      <pre class="language-dart"><code class="language-dart">void addPlaceholder(double width, double height, PlaceholderAlignment alignment, {
  double scale = 1.0,
  double baselineOffset,
  TextBaseline baseline,
}) {
  &#47;&#47; Require a baseline to be specified if using a baseline-based alignment.
  assert((alignment == PlaceholderAlignment.aboveBaseline ||
          alignment == PlaceholderAlignment.belowBaseline ||
          alignment == PlaceholderAlignment.baseline) ? baseline != null : true);
  &#47;&#47; Default the baselineOffset to height if null. This will place the placeholder
  &#47;&#47; fully above the baseline, similar to [PlaceholderAlignment.aboveBaseline].
  baselineOffset = baselineOffset ?? height;
  _addPlaceholder(width * scale, height * scale, alignment.index, (baselineOffset == null ? height : baselineOffset) * scale, baseline == null ? null : baseline.index);
  _placeholderCount++;
  _placeholderScales.add(scale);
}</code></pre>
    </section>

  </div> <!-- /.main-content -->

  <div id="dartdoc-sidebar-right" class="col-xs-6 col-sm-6 col-md-2 sidebar sidebar-offcanvas-right">
  </div><!--/.sidebar-offcanvas-->

</main>

<footer>
  <span class="no-break">
    pin_code_fields 2.3.0+2
  </span>

  
</footer>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="static-assets/typeahead.bundle.min.js"></script>
<script src="static-assets/highlight.pack.js"></script>
<script src="static-assets/URI.js"></script>
<script src="static-assets/script.js"></script>


</body>

</html>
